package book_management.operation.impl;

import book_management.book.Book;
import book_management.book.BookList;
import book_management.operation.IOperation;

public class UpdateOperation implements IOperation {
    //更新书籍
    @Override
    public void work(BookList bookList) {
        System.out.println("你现在进行的是更改书籍操作");
        System.out.println("请输入你要更改的书名");
        String bookName = scanner.next();
        if (bookList.contains(bookName)) {
            Book book = bookList.find(bookName);
            System.out.println("请输入要修改的价格：");
            Double price = scanner.nextDouble();
            System.out.println("请输入要修改的类型：");
            String type = scanner.next();
            bookList.upDate(book,price,type);
            System.out.println("修改成功");
        } else {
            System.out.println("没有此书");
        }
    }
}
